#include <iostream>

using namespace std;

#define INF 0xfffffff

int main(){
    int t;
    cin >> t;

    for (int i = 1; i <= t; i++){
        int n;
        cin >> n;
        int maxsum = -INF;
        int start = 1, end = 1, sum = 0;
        
        for (int j = 1; j <= n; j++){
            int a;
            cin >> a;
            sum += a;

            if (maxsum < sum){
                maxsum = sum;
                end = j;
            }

            if (maxsum < 0){
                sum = 0;
                start = j + 1;
            }

        }
        cout << "Case " << i << ":" << endl << maxsum << " " << start << " " << end << endl;

        if (i != t){
            cout << endl;
        }
    }

    return 0;
}